package crazyboyfeng.autodroid.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateTools {
	
	public static long getTaskTime(String taskTime){
		Calendar cal = Calendar.getInstance();
		String taskDate = cal.get(Calendar.YEAR)+"-"+(cal.get(Calendar.MONTH)+1)+"-"+cal.get(Calendar.DAY_OF_MONTH);
		String mTaskTime = taskDate+ " "+taskTime;
		SimpleDateFormat sDate = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		Date date = new Date();
		try {
			date = sDate.parse(mTaskTime);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		if(date.getTime()<System.currentTimeMillis()){
			date.setDate(date.getDate()+1);
		}
		return date.getTime();
	}
}
